@(account: Option[gitbucket.core.model.Account])(implicit context: gitbucket.core.controller.Context)
<div id="avatar" class="muted">
  @if(account.nonEmpty && account.get.image.nonEmpty){
    <img src="@context.path/@account.get.userName/_avatar" style="width: 120px; height: 120px;"/>
  } else {
    <div id="clickable">Upload Image</div>
  }
</div>
@if(account.nonEmpty && account.get.image.nonEmpty){
  <label>
    <input type="checkbox" name="clearImage"/> Clear image
  </label>
}
<input type="hidden" name="fileId" value=""/>
@if(account.isEmpty || account.get.image.isEmpty){
<script>
$(function(){
  var dropzone = new Dropzone('div#clickable', {
    url: '@context.path/upload/image',
    previewsContainer: 'div#avatar',
    parallelUploads: 1,
    thumbnailWidth: 120,
    thumbnailHeight: 120
  });

  dropzone.on("success", function(file, id){
    $('div#clickable').remove();
    $('input[name=fileId]').val(id);
  });
});
</script>
}
<style type="text/css">
div.dz-filename, div.dz-size, div.dz-progress, div.dz-success-mark, div.dz-error-mark, div.dz-error-message {
  display: none;
}

div#clickable {
  width: 100%;
  text-align: center;
  line-height: 120px;
}

div.dz-message, div.dz-fallback {
  width: 240px;
  color: #000000;
  font-size: 12px;
  line-height: 14px;
}

div#avatar {
  background-color: #f8f8f8;
  border: 1px dashed silver;
  width: 120px;
  height: 120px;
}
</style>